1. Field of the Invention
The invention relates in general to an audio decoding method, and more particularly to a method for decoding Windows Media Audio (WMA) data.
2. Description of the Related Art
The Windows Media Audio (WMA), an audio compression format created by MICROSOFT™, features a small file size and high audio quality, and is particularly suitable for Internet streaming and mobile devices. Further, the WMA format also supports Digital Rights Management (DRM), and is thus prevalent in online music stores. Along with the rise of the digital music industry and developments of Internet techniques, and more particularly with the popularity of wireless transmissions and handheld mobile communication devices, the WMA format has been increasingly regarded as one of the mainstream audio compression formats.
FIG. 1 shows a schematic diagram depicting a structure of the WMA format. The WMA format is a type of Advanced Streaming Format (ASF), and a WMA file includes at least a data part and a header part. The data part includes all audio content and consists of multiple successive packet data. The header part includes various types of information of the WMA file, such as a file size, the number of video/audio streams and decoding information of the packet data.
In a conventional solution for decoding a WMA file, the decoding information in the header part is first accessed, followed by successively decoding the packet data in the data part. FIG. 2A shows a schematic diagram of a WMA decoding process performed by a conventional solution. A decoder first reads the header part when performing the decoding process. The header part includes decoding information of all packet data in the data part. The decoder then accordingly decodes the packet data in sequence until a playback operation ends. FIG. 2B shows a schematic diagram depicting a situation of a fast-forward operation during a WMA decoding process performed by a conventional solution. When the fast-forward operation reaches a playback time of a packet data M, the decoder needs to again read the header part containing the decoding information of all the packet data. From the packet data M onwards, the decoder then accordingly decodes the packet data following the packet data M in sequence until the playback operation ends.
It is known from the above descriptions that, when performing a WMA decoding process using the conventional solution, the header part at a forefront of the file is first read regardless of the decoding start time point, and the decoding process is then performed sequentially from that time point onwards according to the decoding information in the header part. It should be noted that, apart from the decoding information, the header part further includes a large amount of information such as a file format, a file cover and copyrights, implying that the header part may have a significant size. For example, in a WMA file with a file size of 1.3 MB, the header has a size of approximately several thousands of bytes.
FIG. 3 shows a flowchart of a decoding process for a WMA file by a conventional solution. The decoding process begins with Step 300, in which the WMA file is analyzed and divided into a header part and a plurality of packet data. In Step S310, decoding information in the header part is obtained by analyzing contents in the header part. In Step S320, the decoding is performed sequentially from the first packet data according to the decoding information. In Step S330 of the decoding process, it is checked whether a fast-forward command is received. Step S340 is performed when the fast-forward command is received, or else Step S350 is performed. In Step S340, a fast-forward message is generated. The fast-forward message contains time information indicative of a playback position after the fast-forward operation. Step S310 is iterated after Step S340, so as to allow the decoder to again analyze the header part according to the time information in the fast-forward message and to obtain the decoding information in the packet data corresponding to the playback position after the fast-forward operation. Step S320 is again performed to decode onwards from the packet data corresponding to the playback position after the fast-forward operation. In Step S350, when the fast-forward command is not received, it is checked whether the decoding of the current packet data is complete. Step S320 is iterated to continue decoding the current packet data when the decoding of the current packet data is incomplete, or else Step S360 is performed when the decoding of the current packet data is complete. In Step S360, it is determined whether the current packet is the last packet. Step S320 is iterated to continue decoding a next packet data when the current packet is not the last packet, or else Step S370 is performed to end the decoding process when the current packet is the last packet.
In the foregoing decoding process performed by the conventional solution, because the packet data are successively transmitted to the decoder, the decoder needs to read the border positions of each of the packets from the information of the entire header part. However, since the information in the header part comes in a quite large size, a considerable amount of time is needed for analyzing the header part in order to obtain the required information. Consequently, in the occurrence of an error during the decoding process, the decoder is incapable of timely and correctly determining the border positions of the packet, such that no remedial measures can be taken to eventually lead to successive noises caused by successive decoding errors. Further, regardless of the start time point for decoding (including the situation of a fast-forwarding operation), the decoding information in the header part needs to be re-read. As the head part contains a large amount of content, the decoding information can only be obtained by sacrificing a certain period of time for reading and analyzing the header part. Moreover, an additional period of time is also needed for again finding the packet data to be decoded from the data part according to the decoding information. In conclusion, the conventional solution suffers from two noticeable drawbacks—user experience is undesirably affected by the successive noise resulting from decoding errors, and a longer period of time is required for correct decoding in a situation of a fast-forward operation.